#include <compare>
#include <fmt/format.h>
#include <iostream>
#include <stdexcept>
#include <string>

void function3()
{
    std::cout << "In function3" << std::endl;
    throw std::runtime_error{ "run time error in function3\n" };
}
void function2()
{
    std::cout << "function3 is called in function2\n";
    function3();
}

void function1()
{
    std::cout << "function2 is called in function1\n";
    function2();
}
int main()
{
    try
    {
        std::cout << "function1 is called in main\n";
        function1();
    }
    catch (const std::runtime_error &err)
    {
        std::cout << "Exception occured:" << err.what() << "Exception handled in main!\n";
    }
    return 0;
}